package com.matt.repository.nursery;

import com.matt.domain.nursery.NurseryScheduleTempRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * *******************************
 * Created by lch.
 * form com.matt
 * on 2018/11/28
 * *******************************
 */
public interface NurseryScheduleTempRecordRepository extends JpaRepository<NurseryScheduleTempRecord, String>, JpaSpecificationExecutor<NurseryScheduleTempRecord> {

    List<NurseryScheduleTempRecord> findByNurseryScheduleTempId(String nurseryScheduleTempId);

    @Transactional
    @Modifying
    @Query(value = "delete from nursery_schedule_temp_record where nurseryScheduleTempId=:nurseryScheduleTempId",nativeQuery=true)
    int deleteByNurseryScheduleTempId(@Param("nurseryScheduleTempId") String nurseryScheduleTempId);


}
